Canonicalize bare-user-only perms with 0755 mask
authorColin Walters <walters@verbum.org>
Tue, 6 Jun 2017 17:34:27 +0000 (13:34 -0400)
committerAtomic Bot <atomic-devel@projectatomic.io>
Wed, 7 Jun 2017 15:13:55 +0000 (15:13 +0000)
commit0c4b3a2b6da950fd78e63f9afec602f6188f1ab0
tree4faf232476cfb19f15211c40205e9b597e34a65b
parent25696b3fb064bd933d1e05e8175e6d95891fa2c0
Canonicalize bare-user-only perms with 0755 mask

For the flatpak use case where bare-user-only was introduced, we actually
don't want to support s{u,g} id files in particular.

Actually, I can't think of a reason to have anything outside of the
`0755 i.e. (u=rwx,g=rx,o=rx)` mask, so that's what we do here.

This will have the effect of treating existing `bare-user-only` repositories as
corrupted if they have files outside of that mask, but I think we should do this
now; most of the flatpak users will still be on `bare-user`, and we haven't
changed the semantics of that mode yet.

Note that in this patch we will also *reject* file content that doesn't
match this.  This is somewhat asymmetric, since we aren't similarly rejecting
e.g. directory metadata.  But, this will close off the biggest source
of the problem for flatpak (setuid binaries).

See: https://github.com/ostreedev/ostree/pull/908
See: https://github.com/flatpak/flatpak/pull/837

Closes: #909
Approved by: alexlarsson
src/libostree/ostree-repo-commit.c
tests/basic-test.sh